home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr23 / tlxtw204.zip / TLXTWDIR.SLT < prev    next >
Text File  |  1995-01-21  |  4KB  |  131 lines

  1. // tlxtwdir.slt
  2. ////////////////////////////////////////////////////////////////////////
  3. main()
  4. {
  5.  // Edit the below path to the directory where TLXTW Scripts are installed.
  6.  // Then start Telix with the "S" switch.
  7.  //
  8.  // Example:
  9.  //
  10.  // TELIX STLXTWDIR
  11.  //
  12.  // will load Telix and run the "S"cript TLXTWDIR.
  13.  //
  14.  // Or load Telix as you usually do, and assign this to a Function key,
  15.  // etc, so all you do is hit F1 (for example) to change script
  16.  // directories and load Trader.key. if you assign this to a function key
  17.  // then move this script to your normal script directory.
  18.  
  19.  //                        Edit below
  20.  
  21. str tlxtw_dir[64] = "e:\telix\work\slc\slt\tlxtw\";                          //
  22.  
  23.             // The above path is all you must edit.
  24.             // Must end with "\".
  25.  
  26.  _scr_chk_key=0;
  27.  read_file_entry_name();
  28.  strcat( tlxtw_dir, "trader.key" );
  29.  if (keyload( tlxtw_dir ) > -1) {
  30.     fnstrip( tlxtw_dir, 12, _script_dir );
  31.     if(!carrier()) {
  32.         printsc("^M^JTrader.key loaded^M^JScript directory:  " );
  33.         printsc( _script_dir );
  34.         printsc("^M^JAlt-F1 for Help");
  35.         printsc("^M^JAlt-H resets defaults.");
  36.         prints("");
  37.     }
  38.     tlxtw_dir=_script_dir;
  39.     strcat(tlxtw_dir,"Tlxtw.cfg");
  40.     if(!filefind(tlxtw_dir,0)) {
  41.         _scr_chk_key=1;
  42.         call("config");
  43.     }
  44.  }
  45.  else {
  46.     printsc("^M^JError loading file " ); prints( tlxtw_dir );
  47.  }
  48.  if(!carrier())
  49.     cputs_tr(_mdm_init_str);
  50.  else {
  51.     clear_scr();
  52.     capture(_capture_fname);
  53.     //printsc("^M^JBBS:  ");
  54.     //printsc(_entry_name);
  55.     //printsc("  (Ctrl-B to change)^m^j");
  56.     cputs("d");
  57.  }
  58.  _scr_chk_key=1;
  59.  return 1;
  60. }
  61. ///////////////////////////////////////////////////////////////////////////////
  62. append_backslash( str string )
  63. {
  64.     if(subchr(string,strlen(string)-1)!='\')strcat(string,"\");
  65.     return string;
  66. }
  67. /////////////////////////////////////////////////////////////////////////////
  68. //                         Soft Wind
  69. soft_wind(str message, int duration)
  70. {
  71.     int old_chk_key;
  72.     old_chk_key = _scr_chk_key;
  73.     _scr_chk_key = 0;
  74.     int l, h, x, y, key = 0, ts;
  75.     cursor_onoff(0);
  76.     x=getx(); y=gety();
  77.     l = strlen(message)/2;
  78.     h = vsavearea(37-l, 10, 43+l, 14);
  79.     box(37-l, 10, 43+l, 14, 3, 0, 5 );
  80.     pstraxy(message, 40-l  , 12, 11 );
  81.     ts = timer_start(duration);
  82.     while( !key && !time_up(ts)) key=inkey();
  83.     vrstrarea(h);
  84.     cursor_onoff(1);
  85.     gotoxy(x,y);
  86.     timer_free(ts);
  87.     _scr_chk_key = old_chk_key;
  88.     return key;
  89. }
  90. ///////////////////////////////////////////////////////////////////////////////
  91. fgetsi(str buf, int fhandle)//read line from a file and return the int value
  92. {
  93.     fgets(buf,strmaxlen(buf),fhandle);
  94.     return stoi(buf);
  95. }
  96. ///////////////////////////////////////////////////////////////////////////////
  97. read_file_entry_name()
  98. {
  99.     str fname[64],buf[64];
  100.     int f,i,l,baud,parity,data,stop,osk;
  101.  
  102.     osk=_scr_chk_key;_scr_chk_key=0;
  103.     if(!getenv("temp",fname)) {
  104.         soft_wind("^"Temp^" Environment variable not found!",30);
  105.         _scr_chk_key=osk;
  106.         return 0;
  107.     }
  108.     append_backslash(fname);
  109.     strcat(fname,"Entrynam.txt");
  110.     if((f=fopen(fname,"r"))==0) {
  111.         fclearerr(f);
  112.         buf="Open Error ";
  113.         strcat(buf,fname);
  114.         if(carrier())
  115.             call("bbsname");
  116.         //soft_wind(buf,40);
  117.         _scr_chk_key=osk;
  118.         return 0;
  119.     }
  120.     fgets(_entry_name,strmaxlen(_entry_name),f);
  121.     baud=fgetsi(buf   ,f);
  122.     parity=fgetsi(buf ,f);
  123.     data=fgetsi(buf   ,f);
  124.     stop=fgetsi(buf   ,f);
  125.     i=set_cparams(baud,parity,data,stop);
  126.     fclose(f);
  127.     _scr_chk_key=osk;
  128.     return 1;
  129. }
  130. // end of tlxtwdir.slt
  131.